import request from '@/assets/js/request';
import util from '@/assets/js/public';
export function getUserdata(params) {
    console.log('获取用户信息时的名字是：' + params.userName);
    return request(
        {
            url: process.env.VUE_APP_URL + '/action/openapi/bps/common/transmit/getCurrentUser$sso',
            contentType: 'application/json;charset=UTF-8',
            data:{
                'appCode':process.env.VUE_APP_APPCODE,
                'noAction': '1',
                'versionName':process.env.VUE_APP_APPVERSION,
                'kv':{
                    'versionName':process.env.VUE_APP_APPVERSION,
                    'appCode':process.env.VUE_APP_APPCODE,
                    'currentUserCode':util.encrypt(params.userName),
                }
            }
        }
        )
}
// 查询分类信息
export function queryTabs(params){
    return request({
        url:process.env.VUE_APP_URL+'/action/openapi/bps/common/transmit/Video$queryVideoColumn$api',
        contentType:'application/json;charset=UTF-8',
        data:{
            'appCode':process.env.VUE_APP_APPCODE,
            'versionName':process.env.VUE_APP_APPVERSION,
            'kv':Object.assign(params,{
                'appCode':process.env.VUE_APP_APPCODE,
                'currentUserCode':util.encrypt(params.userName),
            })
        }    
    })
}

// 我的待办（分页）
export function myTaskToDo(params,jsonBody){
    return request({
        url:process.env.VUE_APP_URL+'/action/openapi/bps/common/transmit/Video$queryContent$api',
        contentType:'application/json;charset=UTF-8',
        data:{
            'appCode':process.env.VUE_APP_APPCODE,
            'versionName':process.env.VUE_APP_APPVERSION,
            'kv':Object.assign(params,{
                'appCode':process.env.VUE_APP_APPCODE,
                'currentUserCode':util.encrypt(params.userName),
            }),
            'jsonName':'bodyParam',
            'bodyParam':jsonBody
        }    
    })
}


export function getDetail(id,userName){
    return request({
        url:process.env.VUE_APP_URL+'/action/openapi/bps/common/transmit/Video$queryCommentDetail$api',
        contentType:'application/json;charset=UTF-8',
        data:{
            'appCode':process.env.VUE_APP_APPCODE,
            'versionName':process.env.VUE_APP_APPVERSION,
            'kv':{ 
                'source': 'MOBILE',
                'id': id, 
                'appCode':process.env.VUE_APP_APPCODE,
                'currentUserCode':util.encrypt(userName)
            }
        }    
    })
}

export function getCommentList(id,userName){
    return request({
        url:process.env.VUE_APP_URL+'/action/openapi/bps/common/transmit/Video$queryComment$api',
        contentType:'application/json;charset=UTF-8',
        data:{
            'appCode':process.env.VUE_APP_APPCODE,
            'versionName':process.env.VUE_APP_APPVERSION,
            'kv':{ 
                'source': 'MOBILE',
                'id': id, 
                'appCode':process.env.VUE_APP_APPCODE,
                'currentUserCode':util.encrypt(userName)
            }
        }    
    })
}

export function addPlayCount(id,userName){
    return request({
        url:process.env.VUE_APP_URL+'/action/openapi/bps/common/transmit/Video$playNum$api',
        contentType:'application/json;charset=UTF-8',
        data:{
            'appCode':process.env.VUE_APP_APPCODE,
            'versionName':process.env.VUE_APP_APPVERSION,
            'kv':{ 
                'source': 'MOBILE',
                'id': id, 
                'appCode':process.env.VUE_APP_APPCODE,
                'currentUserCode':util.encrypt(userName)
            }
        }    
    })
}


export function commentApi(id,txt,userName){
    return request({
        url:process.env.VUE_APP_URL+'/action/openapi/bps/common/transmit/Video$comment$api',
        contentType:'application/json;charset=UTF-8',
        data:{
            'appCode':process.env.VUE_APP_APPCODE,
            'versionName':process.env.VUE_APP_APPVERSION,
            'kv':{ 
                'source': 'MOBILE',
                'appCode':process.env.VUE_APP_APPCODE,
                'currentUserCode':util.encrypt(userName)
            },
            'jsonName':'bodyParam',
            'bodyParam':{
                'contentId': id, 
                'commentText': txt
            }
        }    
    })
}




